{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/admin/webupload/style.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/static/admin/webupload/style.css">
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">

			<div class="ibox-content">
		    	 <form class="form-horizontal m-t" name="add_new" id="add_new" method="post" action="{:url('add_new')}">
					<div class="form-group">
						<label class="col-sm-3 control-label">标题：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="title" name="title"  class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					   <div class="form-group">
                            <label class="col-sm-3 control-label">图片：</label>
                            <div class="input-group col-sm-4">
                                <input type="hidden" id="data_photo" name="pic" >
                                <div id="fileList" class="uploader-list" style="float:right"></div>
                                <div id="imgPicker" style="float:left">选择图片</div>
                                <img id="img_data" height="100px" style="float:left;margin-left: 50px;margin-top: -10px;" src=""/>
                            </div>
                        </div> 
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">分类</label>
						<div class="input-group col-sm-4">
							<select name="pid" class="form-control">
								<option value="0">--请选择--</option>
								{foreach name="list" item="vo"}
								<option value="{$vo.id}">{$vo.typename}</option>
								{/foreach}
							</select>
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">内容</label>
						<div class="input-group col-sm-4">
							<input type="text" id="content" name="content"  class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">排序</label>
						<div class="input-group col-sm-4">
							<input type="text" id="sort" name="sort"  class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
							<a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
						</div>
					</div>
					<div class="form-group">
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    $(function(){
        $('#add_new').ajaxForm({
            beforeSubmit: checkForm, 
            success: complete, 
            dataType: 'json'
        });
        function checkForm(){
           
        }
        function complete(data){
            if(data.code==200){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('new/index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1});
                return false;   
            }
        }
     
    });

</script>